// 路由组件，建议用函数组件
import React, {Suspense, lazy} from 'react';
import {Switch, Redirect, Route} from "react-router-dom"
import Loading from "../components/Loading"
const Login = lazy(() => import("../views/login/Index"))
const Dashboard = lazy(() => import("../views/backend/Dashboard"))
const Index = () => {
  return (
    <Suspense fallback={<Loading/>}>
      <Switch>
        <Redirect exact from="/" to="/login"/>
        <Route path="/login" component={Login}/>
        <Route path="/dashboard" component={Dashboard}/>
      </Switch>
    </Suspense>
  );
}

export default Index;
